﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Sunny.UI;

namespace RclSystem
{
    public partial class MainCore : UIForm2
    {
        int pageIndex = 1000;
        public MainCore()
        {
            InitializeComponent();
            this.MainTabControl = uiTabControl1;
            uiNavMenu1.TabControl = uiTabControl1;
            uiNavBar1.TabControl = uiTabControl1;
            uiNavBar1.Nodes.Add("基础资料");
            uiNavBar1.Nodes.Add("送货开单");
            uiNavBar1.Nodes.Add("收款开单");
            uiNavBar1.Nodes.Add("报表");
        }

        private void MainCore_Load(object sender, EventArgs e)
        {
            uiNavBar1.SetNodePageIndex(uiNavBar1.Nodes[0], pageIndex);
            uiNavBar1.SetNodeSymbol(uiNavBar1.Nodes[0], 358637);
            TreeNode parent = uiNavMenu1.CreateNode("基础资料", 61451, 24, pageIndex);
            uiNavMenu1.CreateChildNode(parent, AddPage(new Saleman(), ++pageIndex));
            uiNavMenu1.CreateChildNode(parent, AddPage(new Company(), ++pageIndex));

            pageIndex = 2000;
            uiNavBar1.SetNodePageIndex(uiNavBar1.Nodes[1], pageIndex);
            uiNavBar1.SetNodeSymbol(uiNavBar1.Nodes[1], 61818);
            parent = uiNavMenu1.CreateNode("送货开单", 61818, 24, pageIndex);
            uiNavMenu1.CreateChildNode(parent, AddPage(new DeliveryInvoice(), ++pageIndex));

            pageIndex = 3000;
            uiNavBar1.SetNodePageIndex(uiNavBar1.Nodes[2], pageIndex);
            uiNavBar1.SetNodeSymbol(uiNavBar1.Nodes[2], 61950);
            parent = uiNavMenu1.CreateNode("收款开单", 61950, 24, pageIndex);
            uiNavMenu1.CreateChildNode(parent, AddPage(new Receipt(), ++pageIndex));

            pageIndex = 4000;
            uiNavBar1.SetNodePageIndex(uiNavBar1.Nodes[3], pageIndex);
            uiNavBar1.SetNodeSymbol(uiNavBar1.Nodes[3], 362938);
            parent = uiNavMenu1.CreateNode("报表", 362938, 24, pageIndex);
            uiNavMenu1.CreateChildNode(parent, AddPage(new StatementAccount(), ++pageIndex));
            uiNavMenu1.CreateChildNode(parent, AddPage(new Salarys(), ++pageIndex));
            uiNavMenu1.CreateChildNode(parent, AddPage(new SalemanStatement(), ++pageIndex));

            //默认选择首页
            uiNavBar1.SelectedIndex = 0;
        }

        private void uiNavBar1_MenuItemClick(string itemText, int menuIndex, int pageIndex)
        {
            uiNavMenu1.SelectPage(pageIndex);
        }
    }
}
